-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Offload device #145768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Offload device #145768
Conversation
This comment has been minimized.
This comment has been minimized.
@oli-obk Probably stupid question, but where do set parameter names?
but want to generate Edit: I decided I'll just do the full rewrite of the module on llvm-ir level instead of MIR, since that's what I know best (and seathlin mentioned MIR is probably too low eithr way). I'll add more details later |
This comment has been minimized.
This comment has been minimized.
I'll clean this up further later to minimze the amount of c++, but I lost a bit of patience with LLVM's C API, so I just did 100% of the work with the C++ API. With this and the previous (review ready) patch, Rust's amdgcn target runs on a GPU, without manual LLVM-IR rewriting. I'll port it back from C++ to Rust. |
773389b
to
cdbbe9c
Compare
This comment has been minimized.
This comment has been minimized.
@@ -170,6 +172,27 @@ extern "C" void LLVMRustPrintStatistics(RustStringRef OutBuf) { | |||
llvm::PrintStatistics(OS); | |||
} | |||
|
|||
extern "C" void LLVMRustOffloadMapper(LLVMModuleRef M, LLVMValueRef OldFn, LLVMValueRef NewFn) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is too niche to be worth wrapping in Rust. We would need to introduce the ValueToValueMapTy, and handle the mapping of one value to another. Plus we'd need to expose the used CloneFunctionInto as well as the CloneFunctionChangeTypes.
The job Click to see the possible cause of the failure (guessed by this bot)
|
} | ||
|
||
let consider_offload = config.offload.contains(&config::Offload::Enable); | ||
if consider_offload && (cgcx.target_arch == "amdgpu" || cgcx.target_arch == "nvptx64") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these should probably be combined to a target_is_gpu, similar to target_is_like_darwin and target_is_like_aix
r? @oli-obk This adds two more commits on top of the other pr which fixes the host code generation. |
|
LLVM's offload functionality usually expects an extra dyn_ptr argument. We could avoid it,b ut likely gonna need it very soon in one of the follow-up PRs (e.g. to request shared memory). So we might as well already add it.
This PR adds a %dyn_ptr ptr to GPUKernel ABI functions, if the offload feature is enabled.
WIP
r? @ghost